<div>
    <div class="co-dialog modal fade initial-setup-modal in" id="setupModal" style="display: block;">
        <div class="modal-backdrop fade in" style="height: 1000px;"></div>
        <div class="modal-dialog fade in">
            <div class="modal-content kube-deploy-modal">
                <!-- Header -->
                <div class="modal-header">
                    <span class="cor-step-bar">
                        <span class="cor-step active" title="Configure Database" text="1"></span>
                        <span class="cor-step active" title="Setup Database" icon="database"></span>
                        <span class="cor-step active" title="Create Superuser" text="2"></span>
                        <span class="cor-step active" title="Configure Registry" text="3"></span>
                        <span class="cor-step active" title="Validate Configuration" text="4"></span>
                        <span class="cor-step active" title="Setup Complete" icon="download"></span>
                        <span class="cor-step active" title="Deploy Complete" icon="paper-plane"></span>
                    </span>
                    <h4 class="modal-title"><span>Deploy configuration</span></h4>
                </div>
                <!-- Body -->
                <div class="modal-body">
                    <div class="cor-loader" ng-if="$ctrl.state === 'loadingDeployments'"></div>
                    <div class="kube-deploy-modal__body" ng-if="$ctrl.deploymentsStatus.length > 0">
                        <span class="kube-deploy-modal__list-header">The following deployments will be affected:</span>
                        <ul class="kube-deploy-modal__list">
                            <li class="kube-deploy-modal__list-item" ng-repeat="deployment in $ctrl.deploymentsStatus">
                                <i class="fa ci-k8s-logo"></i>
                                <code>{{deployment.name}}</code> with {{deployment.numPods}} <b> {{ deployment.numPods === 1 ? ' pod' : ' pods' }}</b>
                            </li>
                        </ul>
                        <button ng-if="$ctrl.state === 'readyToDeploy'" class="btn btn-primary btn-lg" ng-click="$ctrl.deployConfiguration()">
                            <i class="far fa-paper-plane" style="margin-right: 10px;"></i>
                            Populate configuration to deployments
                        </button>
                        <div ng-if="$ctrl.state === 'deployingConfiguration'">
                            <div class="cor-loader"></div>
                            Deploying configuration...
                        </div>
                        <div ng-if="$ctrl.state === 'cyclingDeployments'">
                            <div class="cor-loader"></div>
                            <span class="kube-deploy-modal__list-header">Cycling deployments...</span>
                            <ul class="kube-deploy-modal__list">
                                <li class="kube-deploy-modal__list-item" ng-repeat="deployment in $ctrl.deploymentsStatus">
                                    <i class="fa ci-k8s-logo"></i>
                                    <code>{{deployment.name}}</code>: {{deployment.message || 'Waiting for deployment information...'}}
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div ng-if="$ctrl.state === 'deployed'" class="modal-footer co-alert co-alert-success">
                    Configuration successfully rolled out and deployed!
                    <br>Note: The web interface of the Quay app may take a few minutes to come up.
                </div>
                <div ng-if="$ctrl.state === 'error'" class="modal-footer alert alert-danger">
                    {{ $ctrl.errorMessage }}
                    <div ng-if="$ctrl.rollingBackStatus !== 'none'" class="rollback">
                        <button ng-if="$ctrl.rollingBackStatus === 'offer'" class="btn btn-default" ng-click="$ctrl.rollbackDeployments()">
                            <i class="fas fa-history" style="margin-right: 10px;"></i>
                            Rollback deployments
                        </button>
                        <div ng-if="$ctrl.rollingBackStatus === 'rolling'" class="cor-loader-inline"></div>
                    </div>
                </div>
                <div ng-if="$ctrl.state === 'rolledBackWarning'" class="modal-footer co-alert co-alert-warning">
                    Successfully rolled back changes. Please try deploying again with your configuration later.
                </div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
</div>